<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
<script language="JavaScript" type="text/JavaScript">

/**
  * 获取当前窗口的参数
  * key,参数的名称
  */
 function getUrlParam(key, uurl){
	 if (uurl == null || uurl == ""){
		uurl = window.location.href;
	 }
	 var url = decodeURI(uurl);
	 var paramMap = {};
	 var firstIndex = url.indexOf("?");
	 var paramStr = url.substring(firstIndex+1);
	 if (paramStr && paramStr != "") {
		 var index = paramStr.indexOf("?") //再次检查参数，避免后面有参数的值是访问地址
		 var lastVal = "";
		 var sflag = false; //标识有第二个问号
		 if(index>0){
			 var urlTemp = paramStr.substring(0, index);
			 var lastIndex = urlTemp.lastIndexOf("=");
			 lastVal = paramStr.substring(lastIndex+1);
			 paramStr = paramStr.substring(0, lastIndex+1);
		 }
		 var paramStrArr = paramStr.split("&");
		 for (var i = 0; i < paramStrArr.length; i++) {
			 var temp = paramStrArr[i];
			 var indexE = temp.indexOf("=");
			 var pKey = temp.substring(0, indexE);
			 var pVal = "";
			 if(sflag && i==(paramStrArr.length-1)){
				 pVal = lastVal;
			 }else{
				 pVal = temp.substring(indexE + 1);
			 }
			 paramMap[pKey] = pVal;
		 }
	 }
	 return paramMap;
 }



/**
*  弹出iframe页面(iframe后面会添加灰色蒙版)
**/
function showIframe(url){
    //添加背景遮罩
    $("<div id='YuFrameMobilePreviewBg' style='cursor:pointer;width:100%;height:100%;background-color: Gray;display:block;z-index:9998;position:absolute;left:0px;top:0px;filter:Alpha(Opacity=30);/* IE */-moz-opacity:0.4;/* Moz + FF */opacity: 0.4; '/>").prependTo('body');

    //添加移动预览的iframe
    $("<div id='showMobilePreview'>" +
        "<div class='mobile_preview_header'><i class='mobile_preview_header_icon'></i></div>" +
        "<div class='mobile_preview_frame'><iframe id='YuFrameMobilePreview' name='YuFrameMobilePreview' ></iframe></div>" +
        "<div class='mobile_preview_footer'><i class='mobile_preview_footer_icon'></i></div>" +
      "</div>").prependTo('body');  
   
     $("#YuFrameMobilePreview").attr("src", url);  
    //点击背景遮罩移除iframe和背景
    // $("#YuFrameMobilePreviewBg").click(function() {
    //     $("#showMobilePreview").remove();
    //     $("#YuFrameMobilePreviewBg").remove();
    // });
}
$(()=>{
  console.log(showIframe(getUrlParam()['url']))
})
</script>
<style type="text/css">
#showMobilePreview {
  z-index: 9999;
  width: 387px;
  height: 768px;
  min-height: 396px;
  max-height: calc(100vh - 64px);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 1;
  text-align: center;
    border-radius: 50px;
   box-shadow:-10px 10px 30px #333333;
}

.mobile_preview_header {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  height: 40px;
  width: 387px;
  background: #eeeff2;
  text-align: center;
  line-height: 40px;
  border-top-right-radius: 50px;
  border-top-left-radius: 50px;
}

.mobile_preview_header_icon {
  display: inline-block;
  width: 65px;
  height: 10px;
  background: #c8c9cc;
  border-radius: 9px;
  vertical-align: middle;
  margin-top: 18px;
}

.mobile_preview_frame {
  width: 375px;
  min-height: 294px;
  height: 667px;
  max-height: calc(100vh - 166px);
  top: 40px;
  left: 0;
  border: 6px solid #eeeff2;
  position: relative;
  background-color: #fff;
  display: block;
}

#YuFrameMobilePreview {
  border: none;
  width: 375px;
  height: 100%;
}

.mobile_preview_footer {
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  height: 52px;
  width: 387px;
  background: #eeeff2;
  text-align: center;
  line-height: 45px;
  border-bottom-right-radius: 50px;
  border-bottom-left-radius: 50px;
}

.mobile_preview_footer_icon {
  display: inline-block;
  width: 43px;
  height: 43px;
  background: #c8c9cc;
  border-radius: 50%;
  vertical-align: middle;
}
body{
     overflow: scroll;
     overflow-x: auto;
     overflow-y: hidden;

}
/* 设置滚动条的样式 */
::-webkit-scrollbar{
    width: 3px;
}
/*滚动槽*/
::-webkit-scrollbar-track{
    box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
    border-radius: 10px;
}
/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.15);
}

</style>

</head>
</body>
<html>